//
//  UIDevice+Adaptation.m
//  KnowledgeHierarchy
//
//  Created by mc on 2020/4/17.
//  Copyright © 2020 linyi. All rights reserved.
//

#import "UIDevice+Adaptation.h"
#import <sys/utsname.h>

@implementation UIDevice (Adaptation)

/**
 判断手机是否是异形屏幕
 @return YES 是 异形屏幕
 */
+ (BOOL)isProfiledScreen {
    if (@available(iOS 11.0, *)) {
        return  [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;
    }
    struct utsname systemInfo;
    uname(&systemInfo);
    NSString*platform = [NSString stringWithCString: systemInfo.machine encoding:NSASCIIStringEncoding];
    if([platform isEqualToString:@"iPhone10,3"] || [platform isEqualToString:@"iPhone10,6"] ||
       [platform isEqualToString:@"iPhone11,8"] || [platform isEqualToString:@"iPhone11,2"] ||
       [platform isEqualToString:@"iPhone11,6"] || [platform isEqualToString:@"iPhone11,4"] ||
       [platform isEqualToString:@"iPhone12,1"] || [platform isEqualToString:@"iPhone12,3"] || [platform isEqualToString:@"iPhone12,5"]) {
        return YES;
    } else {
        return NO;
    }
}

@end
